package com.example.service;

import com.example.config.FeignConfig;
import com.example.config.IndexServiceHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @FeignClient 标识当前接口是一个feign客户端,value="colony-test"
 * 标识针对服务名称为colony-test的服务,对应我们配置文件设置的别名
 * spring.application.name
 * sayHello伪装成http客户端方法,与colony-test的hello方法对应
 *
 */
@FeignClient(value = "colony-test",fallback = IndexServiceHystrix.class,configuration = FeignConfig.class)
public interface IndexService {

    /**
     * 通过fegion伪客户端条用colony-test提供的服务
     */
    @GetMapping("/hello/{name}")
    String sayHello(@PathVariable(value = "name")String name);
}
